package es.ceura.wilder.datastructures;

import java.util.HashMap;

/**
 *
 * @author Jorge Madrid
 */
public enum Headers {

    INSTANCE;
    private static final String HOST = "Host",
            USER_AGENT = "User-Agent",
            ACCEPT = "Accept",
            ACCEPT_LANGUAGE = "Accept-Language",
            ACCEPT_ENCODING = "Accept-Encoding",
            CONNECTION = "Connection",
            CONTENT_LENGTH = "Content-Length",
            CONTENT_TYPE = "Content-Type",
            DATE = "Date",
            COOKIE = "Cookie",
            UNKNOWN = "Unknown";
    private HashMap<String, HeaderType> headers;

    private Headers() {
        this.headers = new HashMap<>();

        headers.put(HOST, HeaderType.HOST);
        headers.put(USER_AGENT, HeaderType.USER_AGENT);
        headers.put(ACCEPT, HeaderType.ACCEPT);
        headers.put(ACCEPT_LANGUAGE, HeaderType.ACCEPT_LANGUAGE);
        headers.put(ACCEPT_ENCODING, HeaderType.ACCEPT_ENCODING);
        headers.put(CONNECTION, HeaderType.CONNECTION);
        headers.put(CONTENT_LENGTH, HeaderType.CONTENT_LENGTH);
        headers.put(CONTENT_TYPE, HeaderType.CONTENT_TYPE);
        headers.put(DATE, HeaderType.DATE);
        headers.put(COOKIE, HeaderType.COOKIE);
        headers.put(UNKNOWN, HeaderType.UNKNOWN);
    }

    public HeaderType getHeader(String header) {
        HeaderType headerType = headers.get(header);
        if (headerType == null) {
            headerType = HeaderType.UNKNOWN;
        }
        return headerType;
    }
}
